<%- include('./layouts/admin_header.ejs')%>

  <%- include('./layouts/admin_navbar.ejs'); %> 
    <div class="container-fluid">
      <div class="page-title">
        <h1>写文章</h1>
      </div>
      <!-- 有错误信息时展示 -->
      <div class="alert alert-danger" hidden>
        <strong>错误！</strong> <span>发生XXX错误</span>
      </div> 
      <form class="row">
        <div class="col-md-9">
          <div class="form-group">
            <label for="title">标题</label>
            <input id="title" class="form-control input-lg" name="title" type="text" placeholder="文章标题">
          </div>
          <div class="form-group">
          <%# 添加id的隐藏域 %>
            <input type="hidden" name="id" value="">
            <label for="content">标题</label>
            <textarea id="content" class="form-control input-lg" name="content" cols="30" rows="10" placeholder="内容"></textarea>
          </div>
        </div>
        <div class="col-md-3">
          <div class="form-group">
            <label for="slug">别名</label>
            <input id="slug" class="form-control" name="slug" type="text" placeholder="slug">
            <p class="help-block">https://zce.me/post/<strong>slug</strong></p>
          </div>
          <div class="form-group">
            <label for="feature">特色图像</label>
            <!-- show when image chose -->
            <%# 添加一个隐藏域，储存上传图片的地址，方便表单收集信息 %>
            <input type="hidden" name="feature" value="" id="imgsave">
            <img class="help-block thumbnail" style="display: none">
            <input id="feature" class="form-control"  type="file">
          </div>
          <div class="form-group">
            <label for="category">所属分类</label>
            <select id="category" class="form-control" name="category_id">
              <option value="1">未分类</option>
              <option value="2">潮生活</option>
            </select>
          </div>
          <div class="form-group">
            <label for="created">发布时间</label>
            <input id="created" class="form-control" name="created" type="datetime-local">
          </div>
          <div class="form-group">
            <label for="status">状态</label>
            <select id="status" class="form-control" name="status">
              <option value="drafted">草稿</option>
              <option value="published">已发布</option>
            </select>
          </div>
          <div class="form-group">
            <input type="button" class="btn btn-primary btnsave" value="保存">
          </div>
        </div>
      </form>
    </div>
  </div>


  <%- include('./layouts/admin_aside.ejs'); %>

<%- include('./layouts/admin_footer.ejs')%>
<script src = "/assets/vendors/ckeditor/ckeditor.js"></script> 
<script src = "/assets/js/common.js"></script>
<script src="/assets/js/postAdd.js"></script>